Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kamelets: load kamelets definition at build time #2549

Closed
wants to merge 1 commit into from

Conversation

lburgazzoli
Copy link
Contributor

@lburgazzoli lburgazzoli commented May 3, 2021

No description provided.

@lburgazzoli
Copy link
Contributor Author

@ppalaga @jamesnetherton this is a draft/poc PR to explore the option to load kamelets at build time, so at runtime we have the definition loaded in the form of route templates. As today it is required to create a temporary camel context, but I'm planning to improve the Yaml DSL loader to run without requiring the camel context and to fail only for the operations that are strictly dependent on having the context (none in this specific case).

Any suggestion on how to improve this would be really appreciated.

Note that the PR can't build at the moment because of quarkusio/quarkus#16954

@lburgazzoli lburgazzoli force-pushed the kamelets branch 3 times, most recently from ee1fd55 to ca8083a Compare May 3, 2021 17:32
for (String kamelet : configuration.kamelets.orElse(Collections.emptyList())) {
final String path = KAMELET_LOCATION + "/" + kamelet + ".yaml";

try (InputStream is = KameletProcessor.class.getResourceAsStream(path)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think using TCCL is the safest option to load classes and resources after the split of class loaders in Quarkus 2.0

@ConfigRoot(name = "camel.kamelet", phase = ConfigPhase.BUILD_TIME)
public class KameletConfiguration {
/**
* List of kamelets.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we should be more descriptive here. Something like the following (not sure all is correct):

Suggested change
* List of kamelets.
* List of resource paths containing Kamelet definitions in YAML format

@valdar
Copy link
Member

valdar commented May 27, 2021

I will give this a look next week as per @lburgazzoli suggestion.

@lburgazzoli
Copy link
Contributor Author

@valdar I think this PR can be closed, correct ?

@valdar
Copy link
Member

valdar commented Jun 17, 2021

Yes

@lburgazzoli
Copy link
Contributor Author

superseded by #2799

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants